<script type="text/javascript" src="includes/JsHttpRequest.js">
</script>
<script type="text/javascript">
// <![CDATA[
function ajax_check_username()
{
	// Create new JsHttpRequest object.
	var req = new JsHttpRequest("utf-8");
	// Code automatically called on load finishing.
	req.onreadystatechange = function()
	{
		if (req.readyState == 4)
		{
			span = document.getElementById('login_check');
			span.style.display = 'block';
			span.innerHTML = req.responseText;
		}
	}
	// Prepare request object (automatically choose GET or POST).
	req.open(null, 'aljax.php', true);
	// Send data to backend.
	req.send( {mode:'check_username',username:document.getElementById('register').username.value} );
}

// ]]>
</script>